<template>
  <section class="main cyx">
    <div class="header">
      <div class="back" @click="back">
        <van-icon name="arrow-left" size="0.48rem" />
      </div>
      <div class="bigsearch">
        <a href="#/search" class="search">
          <van-icon name="search" size="0.4rem" />
          <span>5G手机</span>
        </a>
      </div>
      <div class="more">
        <van-icon name="ellipsis" size="0.4rem" />
      </div>
    </div>
    <div class="zhuti clear">
      <div class="list">
        <li
          v-for="(e,i) in list"
          :key="i"
          :class="[classname,{'currenitem':i==currenitem}]"
          @click="change(i)"
        >{{e.title}}</li>
      </div>
      <div class="gooslist">
        <div class="goods">
          <a href class="banner">
            <img :src="src" alt />
          </a>
          <div class="goodswarp" v-for="(ele) in goods" :key="ele.tab">
            <p class="title">{{ele.tit}}</p>
            <a href="./#/goods" v-for="(ev) in ele.datata" :key="ev.tab">
              <div class="goodsbox">
                <img :src="ev.src" alt />
                <span>{{ev.name}}</span>
              </div>
            </a>
          </div>
        </div>
      </div>
    </div>
  </section>
</template>

<script>
import { data } from "./data.js";
// window.console.log(data[0].url);
export default {
  data() {
    return {
      list: data,
      src: data[0].url,
      goods: data[0].list,
      classname: "listname",
      currenitem: 0
    };
  },
  methods: {
    change(i) {
      let info = data[i];
      // window.console.log(info)
      this.src = info.url;
      this.goods = info.list;
      this.currenitem = i;
    },
    back() {
      this.$router.go(-1);
    }
  }
};
</script>


<style>
.header {
  width: 100%;
  height: 0.88rem;
  background: #fff;
  border-bottom: 1px solid #f5f5f5;
}
.back {
  width: 0.88rem;
  height: 0.88rem;
  float: left;
  position: relative;
}
.back i {
  position: absolute;
  left: 0.2rem;
  top: 0.2rem;
}
.bigsearch {
  float: left;
  position: relative;
  height: 0.88rem;
}
.search {
  display: block;
  width: 5.54rem;
  height: 0.6rem;
  background: #f5f5f5;
  border-radius: 30px;
  padding: 0 0.1rem;
  margin-top: 0.16rem;
}
.search i {
  position: absolute;
  left: 0.2rem;
  top: 0.25rem;
}
.search span {
  float: left;
  font-size: 0.28rem;
  color: #9c9c9c;
  line-height: 0.6rem;
  margin-left: 0.5rem;
}
.more {
  position: relative;
  float: left;
  width: 0.88rem;
  height: 0.88rem;
}
.more i {
  position: absolute;
  top: 0.3rem;
  right: 0.2rem;
}
.zhuti{
  overflow-y: auto;
  flex: 1;
}
.cyx{
  display: flex;
  flex-flow: column;
}
.list {
  height: 100%;
  width: 1.87rem;
  font-size: 0.28rem;
  float: left;
  background: #f5f5f5;
  overflow-y: auto;
  position: sticky;
  top: 0;
  left: 0;
}
.listname {
  width: 1.87rem;
  height: 0.88rem;
  line-height: 0.88rem;
  text-align: center;
}
.currenitem {
  background: #fff;
  color: red;
}
.gooslist {
  float: left;
  height: 100%;
  width: 5.632rem;
  overflow-x: auto;
  position: sticky;
  top: 0;
  left: 0;
}
.banner {
  display: block;
  width: 5.25rem;
  height: 1.65rem;
  margin: 10px auto 0;
}
.banner img {
  width: 5.25rem;
  height: 1.65rem;
}
.goodswarp {
  width: 5.25rem;
  margin: 15px auto;
  border-radius: 5px;
  box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.08);
  overflow: hidden;
}
.title {
  font-size: 0.28rem;
  line-height: 30px;
  padding-left: 10px;
}
.goodsbox {
  width: 1.75rem;
  height: 2.16rem;
  float: left;
}
.goodsbox img {
  display: block;
  width: 1.4rem;
  height: 1.4rem;
  margin: 0 auto;
}
.goodsbox span {
  /* float: left; */
  display: block;
  text-align: center;
  font-size: 0.24rem;
  color: #000;
}
</style>